<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:o="http://openfaces.org/">

    <ui:composition template="/template.xhtml">
        <ui:define name="body">
            <h:form>
                <h:outputText value="#{bundle.CreatePurchaseTitle}" styleClass="titulo"></h:outputText>
                <br/>
                <h:panelGrid columns="3" styleClass="panel">
                    <h:outputLabel value="#{bundle.EditPurchaseLabel_purchaseID}" for="purchaseID" />
                    <h:inputText id="purchaseID" value="#{purchaseController.selected.purchaseID}"
                                 title="#{bundle.EditPurchaseTitle_purchaseID}" 
                                 required="#{purchaseController.campoNulo('purchaseID')}" 
                                 requiredMessage="#{bundle.EditPurchaseRequiredMessage_purchaseID}"
                                 size="#{purchaseController.longCampo('purchaseID')}"
                                 maxlength="#{purchaseController.longCampo('purchaseID')}"/>
                    <h:message for="purchaseID" errorStyle="color: red" infoStyle="color: green"/>
                    <h:outputLabel value="#{bundle.EditPurchaseLabel_purchaseDate}" for="purchaseDate" />
                    <o:dateChooser id="purchaseDate" value="#{purchaseController.selected.purchaseDate}" label="#{bundle.EditPurchaseTitle_purchaseDate}" 
                                   required="#{purchaseController.campoNulo('purchaseDate')}">
                    </o:dateChooser>
                    <h:message for="purchaseDate" errorStyle="color: red" infoStyle="color: green"/>
                    <h:outputLabel value="#{bundle.EditPurchaseLabel_userID}" for="userID" />
                    <h:selectOneMenu id="userID" value="#{purchaseController.selected.userID}" title="#{bundle.EditPurchaseTitle_userID}" 
                                     required="true" requiredMessage="#{bundle.EditPurchaseRequiredMessage_userID}">                        <f:selectItems value="#{userController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:message for="userID" errorStyle="color: red" infoStyle="color: green"/>
                </h:panelGrid>
                <br />
                <h:commandButton action="#{purchaseController.create}" value="Aceptar"/>
                <h:commandButton action="#{purchaseController.prepareList}" value="Cancelar" immediate="true"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
